<?php
require_once("conf/db_connection.php");

$id = $_GET["id"];
$return_str = "";

$query_trip = "SELECT * FROM trip_detail WHERE id='".$id."'";
$result_trip = mysql_query($query_trip) or die("SELECT TRIP DETAIL ".mysql_error());
$row_trip = mysql_fetch_array($result_trip);

$query_truck = "SELECT * FROM truck WHERE id='".$row_trip['truck_id']."'";
$result_truck = mysql_query($query_truck) or die("SELECT TRUCK ".mysql_error());
$row_truck = mysql_fetch_array($result_truck);

$query_trucker = "SELECT * FROM trucker WHERE id='".$row_trip['trucker_id']."'";
$result_trucker = mysql_query($query_trucker) or die("SELECT TRUCKER ".mysql_error());
$row_trucker = mysql_fetch_array($result_trucker);


$return_str = "<table id='pop_table' border='0' style='margin:25px 25px 0px 25px; padding: 0px auto;width:950px;height:250px;background-color:#FFFFFF;'>
<thead style='height:15%;'>
<tr id='hor-minimalist-b'>
	<th colspan='8'>".$row_trip['tas_number']."&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;Booking #".$row_trip['booking_number']."</th>
</tr>
</thead>
<tbody>
<tr>
	<td class='label'>Status</td>
	<td class='td_input'><input readonly='readonly' id='txt_status' name='txt_status' type='text' value='".strtoupper($row_trip['status'])."' /></td>
	<td class='label'>Commodity<br />Type</td>
	<td class='td_input'><input readonly='readonly' id='txt_commodity' name='txt_commodity' type='text' value='".$row_trip['commodity_type']."' /></td>
	<td class='label'>Equipment<br />Size</td>
	<td class='td_input'><input readonly='readonly' id='txt_equip_size' name='txt_equip_size' type='text' value='".$row_trip['equipment_size']."' /></td>
	<td class='label'>Equipment<br />Type</td>
	<td class='td_input'><input readonly='readonly' id='txt_equip_type' name='txt_equip_type' type='text' value='".$row_trip['equipment_type']."' /></td>	
</tr>
<tr>
	<td class='label'>Contact Info</td>
	<td class='td_input'><input readonly='readonly' id='txt_contact' name='txt_contact' type='text' value='".$row_trip['contact_info']."' /></td>
	<td class='label'>Positioning<br />Date</td>
	<td class='td_input'><input readonly='readonly' id='txt_position_date' name='txt_position_date' type='text' value='".$row_trip['positioning_date']."' /></td>
	<td class='label'>Positioning<br />Time</td>
	<td class='td_input'><input readonly='readonly' id='txt_position_time' name='txt_position_time' type='text' value='".$row_trip['positioning_time']."' /></td>
	<td class='label'>Receive<br />Date Time</td>
	<td class='td_input'><input readonly='readonly' id='txt_receive' name='txt_receive' type='text' value='".$row_trip['receive_date_time']."' /></td>	
</tr>
<tr>
	<td class='label'>Pickup<br />Address</td>
	<td class='td_input' colspan='3'><textarea readonly='readonly' id='txt_pick' name='txt_pick' cols='40' rows='1'>".$row_trip['pick_address']."</textarea></td>
	<td class='label'>Instruction</td>
	<td class='td_input' colspan='3'><textarea readonly='readonly' id='txt_instruction' name='txt_instruction' cols='40' rows='1'>".$row_trip['instruction']."</textarea></td>
</tr>
</tbody>
</table>";

$return_str .= "<table id='pop_table' border='0' style='margin:0px 25px 25px 25px; padding: 0px auto;width:950px;height:150px;background-color:#FFFFFF;'>
<thead style='height:2%;'>
<tr id='hor-minimalist-b'>
	<th colspan='8'>Trucker Info&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;".$row_trucker['name']."</th>
</tr>
</thead>
<tbody>
<tr>
	<td class='label'>Truck</td>
	<td class='td_input'><input readonly='readonly' id='txt_truck' name='txt_truck' type='text' value='".$row_truck['plate']."' /></td>	
	<td class='label'>Contact<br />Person</td>
	<td class='td_input'><input readonly='readonly' id='txt_contact_person' name='txt_contact_person' type='text' value='".$row_truck['contact_person']."' /></td>	
	<td class='label'>Position</td>
	<td class='td_input'><input readonly='readonly' id='txt_contact_position' name='txt_contact_position' type='text' value='".$row_truck['contact_position']."' /></td>	
	<td class='label'>Cellphone</td>
	<td class='td_input'><input readonly='readonly' id='txt_contact_cell' name='txt_contact_cell' type='text' value='".$row_truck['contact_cellphone']."' /></td>
</tr>
<tr>
	<td style='text-align:right;' colspan='4'><input onClick='updateStatus(".$id.")' style='width:auto;' type='button' value='Update Status' /></td>
	<td style='text-align:left;' colspan='4'><input onClick='closePopDiv()' style='width:auto;' type='button' value='Close' /></td>
</tr>
</tbody>
</table>";
echo $return_str;
?>